IT IS DISTRIBUTED AS A WAY TO TEST IT ON MORE CONFIGURATIONS THAN I CAN.
THUS, IT IS LIKELY TO HAVE BUGS. USE IT WITH CAUTION AT YOUR OWN RISKS!
What is SmartCopy?
SmartCopy is a freeware that allows copy files/folders between two folders, with a few nice options including:
-if an up to date copy of a file exists in the target folder, then don't copy the file...
-additive copy: files already in the target folder can be left untouched (option),
-only copy files created or modified after a given date,
-only copy objects that have been filtered...
This program is at the very same time a command line and a GUI program. Just use it the way you want!
Installation
This release requires the PR2 release of the BeOS. You may encounter problems with it under earlier releases of the system, so please, upgrade your system!
If you can read this notice, it basically means that you've unpacked the archive.
To install the software, you may want to move the folder "SmartCopy" into a folder that you'll call "Geb" in the /boot/apps folder (if it doesn't already exists!). Then you'll be able to locate all the applications I write in this "Geb" folder, as advised by Be.
Command line users can also move the SmartCopy application in their /boot/home/config/bin/ folder, or create a link to the application there. They'll be able to use the program directly from the shell.
Why should I use SmartCopy?
For several reasons. They are two main reasons which I can see:
- backups,
- do some mirroring of folders between several machines.
For backups?
You may have folders full of documents which you may not want to backup, maybe simply because those documents are coming from the net, are too big and useless to backup (movie or audio files copied from a CD for instance). For that, you'll use the filtering capabilities of SmartCopy to discard those files from the backup. Programmers will discard *.xMAP, *.xSYM files and "(Objects)" folders.
You may also wish to backup only some files. For instance, youm might wish to copy only you Beatware's Writer documents, your images, or your *.cpp, *.h, *.rsrc and *.proj files.
Can't I do this with a query directly from the Tracker?
You can indeed select objects very nicely from the Tracker. The query mecanism is great, but when you have selected a group of files you are kind of stuck. When you copy these files to an other disk, then you can't preserve the hierarchy, add those files to a pre-existing hierarchy, etc.
For mirroring?
This reason is the real one why I built SmartCopy. I wanted to have a mirror of Be's ftp site at home. But of course, my "real" ftp access (a direct connection with significant bandwidth) is at work. There I can use the wget program from a shell to create this mirror on my machine. But since the mirror is currently 130MB big, it can't be put on a zip disk. Plus, it would be dumb to have a zip full with this copy when you may need the extra space for other files... The solution is then to copy on the zip only the files of the mirror that have been modified in the last week and remove the extra files. (For that, select the "Smart-Clone to Target" and "Modified" options and type "last week" in the "Since" field.) After you've updated your mirror with wget, you'll update your transfer folder on your zip drive. The size of this folder will remain reasonable assuming that not too many files are added to Be's ftp site in the same week...
Side note: There is one little problem with wget: if a file is removed from the ftp site, it doesn't remove its copy in your mirror. I've made a work around for that. It's a program called "CleanMirror" that is given in this distribution. Also note that this "problem" turned out to be an advantage for me, since it allows me to clean up every copy of the mirror, including the one I have at home! In CleanMirror's folder, you'll find all the necessary scripts to do those operation with no pain.
How to use SmartCopy?
For shell users, please refer to the included help. Simply type:
$ SmartCopy --help
...in a shell, and read. The following instruction, though oriented for the GUI users might also help you understand the idea behind this program. Note that you can only filter files based on their date. Other filter options can only be accessed through the GUI interface.
You launch SmartCopy from the shell by typing it's name and pressing <Return>, or simply, by double-clicking on its icon. If you launch it from a shell, then you'll have some feedback about the operation as it is going on, including what files are copied, updated, removed or renamed...
SmartCopy's core idea is to copy files and folders from one folder to an other one, preserving a folder hierarchy. To select those two folders, you'll use drag'n drop. To select the source folder (which content will be [partially]copied), drag'n drop a folder from a Tracker's window over the "Source" region in SmartCopy's window. To select the destination folder (to which files will be copied), drag'n drop a folder from a Tracker's window over the "Target" region in SmartCopy's window.
So what, then? The Tracker also allows me to copy files from one folder to an other one! And it seems simpler with the Tracker!
Well, there are the added values for taking the time to use SmartCopy!
What files are you going to copy?
SmartCopy allows you "select" all or only some files from the source folder. To copy everything, select the "All" option for the "Copy Files" menu field.You may select the files "Created" after a date, "Modified" after a date, "Created or Modified" after a date. Note that these time restriction do not apply to folders. Select the appropriate option in the "Copy Files" menu field. You then have to type in a date in the "Since" text field. The date format is rather permissive, just as for the Tracker. You may type something like "Yesterday", "8/10/97", "-15 days" and the like. Rather cool. Just like the Tracker. Well, maybe it's just because we just use the same library function! :-) The files in the source folder not matching the time criteria (if any) will be simply ignored. They are left untouched, just as all the other files and folders located in the source folder.
More. You can create a list of filters. For that, create on the "Filters..." button. A modal dialog will allow you to set up your list of filters and the action that should be taken after each on.
To add a new filter, simply press the "Add" button on the left of the list of filter. To remove a filter, first select it in the list (click on it), and press the delete or the backspace key.
The list zone shows the current list of filters and show what they are in a sumed-up way. It's probably not very very readable, so simply click on the filter you wish to understand to see its details in the boxes located on the right of the list.
Since filter are always applied to the objects from the first one in the list, and then down, you may need to reorder your filters. Drag'n drop the filters in the list as you wish to reorder them.
To set the behavior of each of the filters, first select the filter in the list, and then change the options that appear in the "Apply To", "Test", "If Test Is True" and "If Test Is False" zones.
The "Apply To" option lets you say on which type of object the filter you be applied. If the current object is not of a selected type (if the object is a file and that you've selected the "Folders" item, or if it's a folder and that you've selected the "Files" item), then the filter is simply ignored and the next one on the list is then applied.
The "Test" option lets you specify what is the test. You may test the object's name or it's type (note that even folders may have a type in the BeOS, but that it's probably useless to test a folder's type...). The menu field "If" lets you specify the test, and the text field on its right, the text against which the test should be applied. Note that you should always press the return key after you've entered text in this zone to be sure that your modification has been taken into account.
You then have to specify the action that should be taken. The "If Test Is True" zone, lets you say what the program should do when the test is true for the current object. Select the "Copy" option in this box if the object should be copied. Select the "Ignore" option if the object should not be copied. Note that in these two cases, the next filters in the list will not be applied to the object and that it is thus the first filter that gives such an action that rules. If you want the next filter to be applied when the test is true, simply select the "Next Filter" option.
The "If Test Is False" zone works in the same way as the previous one. It simply tells what the taken action should be when the object failed to pass the test.
Note that of course the content of a folder that has been rejected by the filtering mecanism will not be searched, what ever it contains.
When no action has been taken for an object after all the filters have been applied one by one, then the action taken depends on the type of this object. If the object is a folder, then it is copied (that is, each of the object inside it will be filtered...). If the object is a file, then action taken is to be chosen in the "Remaining Files" option located under the list of filters. Select the "Copy" option to have the file copied, select the "Ignore" option otherwise.
When you are done selecting the filters, press the "Apply" button. If you wish to cancel all modification made to the list of filters, then press the "Cancel" button.
What about the links?
You set SmartCopy's behavior regarding links with the "Links" menu field. You may choose to ignore all the links in the source folder or its sub-folders by choosing the "Ignore" option. The links will be ignored, even if the object they refer to would be selected. You may choose to copy all these links as links by choosing the "Copy" option. The links will then be filtered as simple files (even if they point to a folder) and no reference to the object they point to will be used. For instance, the creation and modification dates used are the ones of the link itselft and not the ones of the target object... You may choose the opposite option and always want to copy the object refered to by a link and not the link itself. For that, select the "Always Traverse" option. A last choice allows you to traverse the links, only if they are in the immediate content of the source folder. This is the "Traverse First Level" option. This behavior is very nice if you want to use SmartCopy to make backups. You'll create of folder in which you'll place links to the folders or items you want to backup, and you won't be scared about links that may create infinite loops...
Important note: When a link is traversed, it is equivalent to a virtual object which name would be the name of the link itself (not the name of the object it points too) and which all other properties (type, content, attributes, creation date, etc.) would be the ones of the target object. In particular, the name of the link itself is used during the filtering operation, but it's the type of the target object that is used...
This behavior alows you to be sure that two links in the same folder won't conflict because they point to objects that have the same name...
What about the files and folders that might already be in the destination folder?
You set SmartCopy's behavior with the "Operation" menu field. With the "Copy Files" option, the "Links" option, and the filters, you have selected a virtual set of files and folders, organised in folders and sub-folders.
If you select the "Clone to Target" or the "Smart-Clone to Target" option, then after SmartCopy's action you will find exactly this virtual set in the target folder. All other file or folder that was in the target folder before the operation has been removed (not trashed, deleted!).
If you've selected the "Add to Target" or the "Smart-Add to Target" option, then those files and folders will be left in the target folder, as long as they don't conflict with an object of the virtual set. Files with the same names will be updated to reflect the source. If two objects of different types conflicts (there are three different types of objects: files, folders and links), then the object in the target folder will be renamed to allow the new object to be copied. For instance, if a file called "foo" exists in the source folder, and a folder also called "foo" exists in the destination folder, then the folder "foo" is renamed appropriatly, probably "foo - 1", if this name doesn't conflict with some other object...
How are you going to copy a file if it already exists in the target folder?
When two files with the same name and the same relative position exist in the source folder and in the target folder, then they are considered equal only if their length, creation and modification date are equal. If two files are not equal, then the file in the target folder is always updated (including its attributes). If the two files are equal, then it depends on your choice in the "Operation" menu field. If you've selected "Smart-Clone to Target" or "Smart-Add to Target", then the target file is left untouched, otherwise, the target file is copied anyway.
What about attributes?
You may choose to always copy the attributes, wether the file is copied, updated or not. This is the "Force Copy" option for attributes. You may choose to always copy them only if the file is created or updated. This is the "Normal Copy" option for attributes. Folders' attributes are then always copied. If you don't want folders' attributes to be copied, then use the "Files Only" option for attributes. You may finaly choose to never copy attributes: select the "Never Copy" option for attributes.
If you are copying some attributes (for files or folder), then you may also choose to copy or not the attributes stored with the files and folders by the Tracker to save icons' positions, folders sizes and settings. (All these attributes can be easily recognised: their name always start with "_trk/"). Check the "Don't Copy Tracker's Attributes" as you desire.
What about saving all those settings?
When you use SmartCopy with the GUI interface, you will always save all your settings automatically, either in the default preference file (saved in the /boot/home/confing/settings/Geb/ folder) or in a setting file that you'll have created pressing on the "Save As" button, or which you've use when launching SmartCopy.
Is that all?
Well, nearly. You'll probably find that this tool is nice to use, because it does simple things like saving the windows' positions and settings (for every of its windows, including the file panel. Nothing extraordinary really, but don't you dream that StyledEdit would do these trivial things?), or because you can pause and/or stop a copy at any time while having a feedback on the copy's state.
I have decided to make this application multiple launch, so that you'll be able to use it in scripts without any special care. A shell and a GUI use won't conflict. You should not try to change that.
The application is also a background application. It means that it won't appear in the Tracker's bar. I prefer it this way, because shell uses won't come in your face, but I suppose that some won't like it. Well, you can change that using the Tracker's FileType add-on.
License
This software is a freeware.
This software is provided as is without any warranty.
I've tested this program the best I could, but I'm far from being perfect... So please, don't risk any critical data... make backups!
USE SMARTCOPY AT YOUR OWN RISKS. IF YOU MISSUSE SMARTCOPY, YOU CAN EASILY LOSE DATA. SPECIFICALLY, ALL DATA IN THE DESTINATION FOLDER CAN BE REMOVED IF YOU DON'T SELECT THE APPROPRIATE SETTINGS!
I'll be glad to hear about your bug reports, problems, comments, flames...
This notice was especially painfull to write...
You can mail me directly at: berenger@francenet.fr
Known Bugs/Problems
-Forget about writting to hfs volumes with SmartCopy. There are way to many bugs in the hfs plug-in for that. It fakes attributes to convert Finder settings into Tracker settings stored in attributes (for the file's position in a window, etc.) or for the resource fork. But then, you can't remove these attributes and there are minor problems when dealing with the resource fork. Copying from a hfs volumes seems to work fine though.
-Some redraw problems resizing the filter window. You might have a refresh problem when playing with the window's width. In this case, just change the window's width a little bit again, and the redraw should be good again.
-I've tried to do so that the objects sizes grow and shrink in a smart way. When two objects share a space, it works fine, but when three objects share a space, then you have to do everything yourself to get it right. I figured that though it wasn't looking perfect, it was good enough so.
-When traversing links, the name given to the copy object is the name of the link itself, not necessarily the name of the copied object. For instance, when you have a link called "link to file" that points to a file called "target file", and that the link is traversed, then a copy of the file called "target file" is created but is given the name "link to file". This behavior should not be a real problem and it solves very very tricky issues, such as when a folder contains two links that points to objects that have the same name. This is not a bug (I've added lines to implement this behavior!), but it may sound weird in the first thought (IMO, it's a feature that solves bad potential problems).
History
-v1.0ß5
- Improved drag'n drop support of objects over the window.
-v1.0ß4 Improved the user interface a little bit.
- Removed the "Remove", "Up" and "Down" button from the filter window.
Those operations should now be done with drag'n drop or with the keyboard.
- Drag'n drop now uses the content of the filter.
- Now only counts files in the count of items to copy. Visual feedback takes into
account the numbers of folders encountered though, for a better consistency.
- Improved the messages reported by the status window.
- You can now drop a setting file directly in the window.
- The default setting file is now an ordinary setting file (with an icon).
-v1.0ß3 Added several major features.
- added the filtering capabilities on the name or type.
- rearranged the way to operate. The "Add" and "Clone" buttons have disappeared.
They are replaced with a "Perform" button and a "Operation" menu field.
- You can now force the copy of each file.
- Added options when copying filters.
- now has real setting files that store every information. When simply double-clicked,
the default setting file is created/used in Geb's preference folder.
- removed all flickering when dragging over the target and source boxes.
- fixed the resizing bug present with every BBox object.
-v1.0ß2 (November 1st 1997): first public release.
To Do
- Ability to produce directly a zip archive with the virtual group of files.
- Add some about-window somewhere.
- Find other ideas. If you have suggestions, well, just mail them to me!